use jizi_config::PREVIEW;
use jizi_fs::Xdg ;

use super::Actions;

impl Actions{
    pub (super) fn clear_cache(){ // 根据cache dir的具体设置进行清理 如果目录不匹配保守不清空
        if PREVIEW.cache_dir == Xdg::cache_dir(){
            println!("Clearing cache directory:\n{:?}" , PREVIEW.cache_dir) ;
            std::fs::remove_dir_all(&PREVIEW.cache_dir).unwrap() ;
        }else {
            println!(
                "You've changed the default cache directory, for your data's safety, please clear it manually:\n {:?}" , 
                PREVIEW.cache_dir 
            );
        }
    }
}